3.1043 \(\int (a+i a \tan (e+f x))^4 (c-i c \tan (e+f x))^n \, dx\)

Optimal. Leaf size=134 \[ \frac{6 i a^4 (c-i c \tan (e+f x))^{n+2}}{c^2 f (n+2)}-\frac{i a^4 (c-i c \tan (e+f x))^{n+3}}{c^3 f (n+3)}+\frac{8 i a^4 (c-i c \tan (e+f x))^n}{f n}-\frac{12 i a^4 (c-i c \tan (e+f x))^{n+1}}{c f (n+1)} \]

[Out]

((8*I)*a^4*(c - I*c*Tan[e + f*x])^n)/(f*n) - ((12*I)*a^4*(c - I*c*Tan[e + f*x])^(1 + n))/(c*f*(1 + n)) + ((6*I
)*a^4*(c - I*c*Tan[e + f*x])^(2 + n))/(c^2*f*(2 + n)) - (I*a^4*(c - I*c*Tan[e + f*x])^(3 + n))/(c^3*f*(3 + n))

________________________________________________________________________________________

Rubi [A]  time = 0.153287, antiderivative size = 134, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 31, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.097, Rules used = {3522, 3487, 43} \[ \frac{6 i a^4 (c-i c \tan (e+f x))^{n+2}}{c^2 f (n+2)}-\frac{i a^4 (c-i c \tan (e+f x))^{n+3}}{c^3 f (n+3)}+\frac{8 i a^4 (c-i c \tan (e+f x))^n}{f n}-\frac{12 i a^4 (c-i c \tan (e+f x))^{n+1}}{c f (n+1)} \]

Antiderivative was successfully verified.

[In]

Int[(a + I*a*Tan[e + f*x])^4*(c - I*c*Tan[e + f*x])^n,x]

[Out]

((8*I)*a^4*(c - I*c*Tan[e + f*x])^n)/(f*n) - ((12*I)*a^4*(c - I*c*Tan[e + f*x])^(1 + n))/(c*f*(1 + n)) + ((6*I
)*a^4*(c - I*c*Tan[e + f*x])^(2 + n))/(c^2*f*(2 + n)) - (I*a^4*(c - I*c*Tan[e + f*x])^(3 + n))/(c^3*f*(3 + n))

Rule 3522

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Di
st[a^m*c^m, Int[Sec[e + f*x]^(2*m)*(c + d*Tan[e + f*x])^(n - m), x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] &&
EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0] && IntegerQ[m] &&  !(IGtQ[n, 0] && (LtQ[m, 0] || GtQ[m, n]))

Rule 3487

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[1/(a^(m - 2)*b
*f), Subst[Int[(a - x)^(m/2 - 1)*(a + x)^(n + m/2 - 1), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x
] && EqQ[a^2 + b^2, 0] && IntegerQ[m/2]

Rule 43

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rubi steps

\begin{align*} \int (a+i a \tan (e+f x))^4 (c-i c \tan (e+f x))^n \, dx &=\left (a^4 c^4\right ) \int \sec ^8(e+f x) (c-i c \tan (e+f x))^{-4+n} \, dx\\ &=\frac{\left (i a^4\right ) \operatorname{Subst}\left (\int (c-x)^3 (c+x)^{-1+n} \, dx,x,-i c \tan (e+f x)\right )}{c^3 f}\\ &=\frac{\left (i a^4\right ) \operatorname{Subst}\left (\int \left (8 c^3 (c+x)^{-1+n}-12 c^2 (c+x)^n+6 c (c+x)^{1+n}-(c+x)^{2+n}\right ) \, dx,x,-i c \tan (e+f x)\right )}{c^3 f}\\ &=\frac{8 i a^4 (c-i c \tan (e+f x))^n}{f n}-\frac{12 i a^4 (c-i c \tan (e+f x))^{1+n}}{c f (1+n)}+\frac{6 i a^4 (c-i c \tan (e+f x))^{2+n}}{c^2 f (2+n)}-\frac{i a^4 (c-i c \tan (e+f x))^{3+n}}{c^3 f (3+n)}\\ \end{align*}

Mathematica [A]  time = 5.81675, size = 180, normalized size = 1.34 \[ \frac{i a^4 \sec ^2(e+f x) (\cos (4 f x)+i \sin (4 f x)) (c \sec (e+f x))^n \left (\left (n^3+6 n^2+11 n+12\right ) (2 \cos (2 (e+f x))-1)+i n \tan (e+f x) \left (2 \left (n^2+6 n+11\right ) \cos (2 (e+f x))+n^2+9 n+20\right )+3 \left (n^2+7 n+12\right )\right ) \exp (n (-\log (c \sec (e+f x))+\log (c-i c \tan (e+f x))))}{f n (n+1) (n+2) (n+3) (\cos (f x)+i \sin (f x))^4} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + I*a*Tan[e + f*x])^4*(c - I*c*Tan[e + f*x])^n,x]

[Out]

(I*a^4*E^(n*(-Log[c*Sec[e + f*x]] + Log[c - I*c*Tan[e + f*x]]))*Sec[e + f*x]^2*(c*Sec[e + f*x])^n*(Cos[4*f*x]
+ I*Sin[4*f*x])*(3*(12 + 7*n + n^2) + (12 + 11*n + 6*n^2 + n^3)*(-1 + 2*Cos[2*(e + f*x)]) + I*n*(20 + 9*n + n^
2 + 2*(11 + 6*n + n^2)*Cos[2*(e + f*x)])*Tan[e + f*x]))/(f*n*(1 + n)*(2 + n)*(3 + n)*(Cos[f*x] + I*Sin[f*x])^4
)

________________________________________________________________________________________

Maple [C]  time = 0.446, size = 1784, normalized size = 13.3 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+I*a*tan(f*x+e))^4*(c-I*c*tan(f*x+e))^n,x)

[Out]

8*I*a^4/(1+n)/f/(exp(2*I*(f*x+e))+1)^3/(3+n)/n/(2+n)*(c^n/((exp(2*I*(f*x+e))+1)^n)*2^n*n^3*exp(-1/2*I*Pi*csgn(
I*c/(exp(2*I*(f*x+e))+1))^3*n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn(I*c)*n)*exp(1/2*I*Pi*csgn(I*
c/(exp(2*I*(f*x+e))+1))^2*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(-1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))*csgn(I*
c)*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(6*I*f*x)*exp(6*I*e)+6*c^n/((exp(2*I*(f*x+e))+1)^n)*2^n*n^2*exp(-1/2*I*P
i*csgn(I*c/(exp(2*I*(f*x+e))+1))^3*n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn(I*c)*n)*exp(1/2*I*Pi*
csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(-1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))*
csgn(I*c)*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(6*I*f*x)*exp(6*I*e)+11*c^n/((exp(2*I*(f*x+e))+1)^n)*2^n*n*exp(-1
/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^3*n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn(I*c)*n)*exp(1/2
*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(-1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e)
)+1))*csgn(I*c)*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(6*I*f*x)*exp(6*I*e)+3*c^n/((exp(2*I*(f*x+e))+1)^n)*2^n*n^2
*exp(-1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^3*n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn(I*c)*n)*
exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(-1/2*I*Pi*csgn(I*c/(exp(2*I*
(f*x+e))+1))*csgn(I*c)*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(4*I*f*x)*exp(4*I*e)+6*c^n/((exp(2*I*(f*x+e))+1)^n)*
2^n*exp(-1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^3*n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn(I*c)*
n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(-1/2*I*Pi*csgn(I*c/(exp(2
*I*(f*x+e))+1))*csgn(I*c)*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(6*I*f*x)*exp(6*I*e)+15*c^n/((exp(2*I*(f*x+e))+1)
^n)*2^n*n*exp(-1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^3*n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn
(I*c)*n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(-1/2*I*Pi*csgn(I*c/
(exp(2*I*(f*x+e))+1))*csgn(I*c)*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(4*I*f*x)*exp(4*I*e)+18*c^n/((exp(2*I*(f*x+
e))+1)^n)*2^n*exp(-1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^3*n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*
csgn(I*c)*n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(-1/2*I*Pi*csgn(
I*c/(exp(2*I*(f*x+e))+1))*csgn(I*c)*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(4*I*f*x)*exp(4*I*e)+6*c^n/((exp(2*I*(f
*x+e))+1)^n)*2^n*n*exp(-1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^3*n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1
))^2*csgn(I*c)*n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(-1/2*I*Pi*
csgn(I*c/(exp(2*I*(f*x+e))+1))*csgn(I*c)*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(2*I*f*x)*exp(2*I*e)+18*c^n/((exp(
2*I*(f*x+e))+1)^n)*2^n*exp(-1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^3*n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e
))+1))^2*csgn(I*c)*n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(-1/2*I
*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))*csgn(I*c)*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(2*I*f*x)*exp(2*I*e)+6*c^n/((e
xp(2*I*(f*x+e))+1)^n)*2^n*exp(-1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))*n*(csgn(I*c/(exp(2*I*(f*x+e))+1))-csgn(
I*c))*(csgn(I*c/(exp(2*I*(f*x+e))+1))-csgn(I/(exp(2*I*(f*x+e))+1)))))

________________________________________________________________________________________

Maxima [B]  time = 2.05164, size = 1161, normalized size = 8.66 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^4*(c-I*c*tan(f*x+e))^n,x, algorithm="maxima")

[Out]

(3*2^(n + 4)*a^4*c^n*cos(n*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1)) - 3*I*2^(n + 4)*a^4*c^n*sin(n*arct
an2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1)) + 48*(a^4*c^n*n + 3*a^4*c^n)*2^n*cos(-2*f*x + n*arctan2(sin(2*f*x
 + 2*e), cos(2*f*x + 2*e) + 1) - 2*e) + 24*(a^4*c^n*n^2 + 5*a^4*c^n*n + 6*a^4*c^n)*2^n*cos(-4*f*x + n*arctan2(
sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1) - 4*e) + 8*(a^4*c^n*n^3 + 6*a^4*c^n*n^2 + 11*a^4*c^n*n + 6*a^4*c^n)*2^
n*cos(-6*f*x + n*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1) - 6*e) - (48*I*a^4*c^n*n + 144*I*a^4*c^n)*2^n
*sin(-2*f*x + n*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1) - 2*e) - (24*I*a^4*c^n*n^2 + 120*I*a^4*c^n*n +
 144*I*a^4*c^n)*2^n*sin(-4*f*x + n*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1) - 4*e) - (8*I*a^4*c^n*n^3 +
 48*I*a^4*c^n*n^2 + 88*I*a^4*c^n*n + 48*I*a^4*c^n)*2^n*sin(-6*f*x + n*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*
e) + 1) - 6*e))/(((-I*n^4 - 6*I*n^3 - 11*I*n^2 - 6*I*n)*(cos(2*f*x + 2*e)^2 + sin(2*f*x + 2*e)^2 + 2*cos(2*f*x
 + 2*e) + 1)^(1/2*n)*cos(6*f*x + 6*e) + (-3*I*n^4 - 18*I*n^3 - 33*I*n^2 - 18*I*n)*(cos(2*f*x + 2*e)^2 + sin(2*
f*x + 2*e)^2 + 2*cos(2*f*x + 2*e) + 1)^(1/2*n)*cos(4*f*x + 4*e) + (n^4 + 6*n^3 + 11*n^2 + 6*n)*(cos(2*f*x + 2*
e)^2 + sin(2*f*x + 2*e)^2 + 2*cos(2*f*x + 2*e) + 1)^(1/2*n)*sin(6*f*x + 6*e) + 3*(n^4 + 6*n^3 + 11*n^2 + 6*n)*
(cos(2*f*x + 2*e)^2 + sin(2*f*x + 2*e)^2 + 2*cos(2*f*x + 2*e) + 1)^(1/2*n)*sin(4*f*x + 4*e) + (-I*n^4 - 6*I*n^
3 - 11*I*n^2 + (-3*I*n^4 - 18*I*n^3 - 33*I*n^2 - 18*I*n)*cos(2*f*x + 2*e) + 3*(n^4 + 6*n^3 + 11*n^2 + 6*n)*sin
(2*f*x + 2*e) - 6*I*n)*(cos(2*f*x + 2*e)^2 + sin(2*f*x + 2*e)^2 + 2*cos(2*f*x + 2*e) + 1)^(1/2*n))*f)

________________________________________________________________________________________

Fricas [B]  time = 1.66228, size = 606, normalized size = 4.52 \begin{align*} \frac{{\left (48 i \, a^{4} +{\left (8 i \, a^{4} n^{3} + 48 i \, a^{4} n^{2} + 88 i \, a^{4} n + 48 i \, a^{4}\right )} e^{\left (6 i \, f x + 6 i \, e\right )} +{\left (24 i \, a^{4} n^{2} + 120 i \, a^{4} n + 144 i \, a^{4}\right )} e^{\left (4 i \, f x + 4 i \, e\right )} +{\left (48 i \, a^{4} n + 144 i \, a^{4}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \left (\frac{2 \, c}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}\right )^{n}}{f n^{4} + 6 \, f n^{3} + 11 \, f n^{2} + 6 \, f n +{\left (f n^{4} + 6 \, f n^{3} + 11 \, f n^{2} + 6 \, f n\right )} e^{\left (6 i \, f x + 6 i \, e\right )} + 3 \,{\left (f n^{4} + 6 \, f n^{3} + 11 \, f n^{2} + 6 \, f n\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + 3 \,{\left (f n^{4} + 6 \, f n^{3} + 11 \, f n^{2} + 6 \, f n\right )} e^{\left (2 i \, f x + 2 i \, e\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^4*(c-I*c*tan(f*x+e))^n,x, algorithm="fricas")

[Out]

(48*I*a^4 + (8*I*a^4*n^3 + 48*I*a^4*n^2 + 88*I*a^4*n + 48*I*a^4)*e^(6*I*f*x + 6*I*e) + (24*I*a^4*n^2 + 120*I*a
^4*n + 144*I*a^4)*e^(4*I*f*x + 4*I*e) + (48*I*a^4*n + 144*I*a^4)*e^(2*I*f*x + 2*I*e))*(2*c/(e^(2*I*f*x + 2*I*e
) + 1))^n/(f*n^4 + 6*f*n^3 + 11*f*n^2 + 6*f*n + (f*n^4 + 6*f*n^3 + 11*f*n^2 + 6*f*n)*e^(6*I*f*x + 6*I*e) + 3*(
f*n^4 + 6*f*n^3 + 11*f*n^2 + 6*f*n)*e^(4*I*f*x + 4*I*e) + 3*(f*n^4 + 6*f*n^3 + 11*f*n^2 + 6*f*n)*e^(2*I*f*x +
2*I*e))

________________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))**4*(c-I*c*tan(f*x+e))**n,x)

[Out]

Timed out

________________________________________________________________________________________

Giac [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int{\left (i \, a \tan \left (f x + e\right ) + a\right )}^{4}{\left (-i \, c \tan \left (f x + e\right ) + c\right )}^{n}\,{d x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^4*(c-I*c*tan(f*x+e))^n,x, algorithm="giac")

[Out]

integrate((I*a*tan(f*x + e) + a)^4*(-I*c*tan(f*x + e) + c)^n, x)